﻿using System.Linq;
using System.Web.Mvc;
using StudyTracker.Domain.Entities;

namespace StudyTracker.Web.Controllers
{
	[Authorize]
	public partial class BaseController : Controller
	{
		private Student _currentStudent;
		protected Student CurrentStudent
		{
			get {
				return _currentStudent ??
				       (_currentStudent = Student.Find(x => x.AuthenticationIdentifier == User.Identity.Name).SingleOrDefault());
			}
		}
	}
}